import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooCodelabsController } from '../../../controllers';
const uctoocodelabsRouter = new Router();
const codelabsController = new uctooCodelabsController();

uctoocodelabsRouter.post('/add', requireUser, codelabsController.add);
uctoocodelabsRouter.post('/edit', requireUser, rowLevelPermission('uctoo/codelabs'), codelabsController.edit);
uctoocodelabsRouter.post('/del', requireUser, rowLevelPermission('uctoo/codelabs'), codelabsController.delete);

//For getting codelabs with permission control
uctoocodelabsRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/codelabs'), codelabsController.getSingle);
uctoocodelabsRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/codelabs'), codelabsController.getMany);
uctoocodelabsRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/codelabs'), codelabsController.getMany);

//#endregion AutoCreateCode
export default uctoocodelabsRouter;
